package com.leetcode.two_pointers;

import com.leetcode.basic.ListNode;

/**
 * @author Dennis Li
 * @date 2020/7/18 17:25
 */
public class HashCycle_141 {

    public boolean hasCycle(ListNode head) {
        ListNode fast = head, slow = head;
        while (fast != null && fast.next != null) {
            fast = fast.next.next;
            slow = slow.next;
            if(fast == slow) return true;
        }
        return false;
    }

}
